package app;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

import bean.Customer;

@Component
public class App 
{
    public static void main( String[] args )
    {
    	// Load Spring configuration.
    	ApplicationContext context = 
    	  new ClassPathXmlApplicationContext(new String[] {"spring.xml"});
 
    	// Load app bean in "spring.xml".
    	App app = context.getBean(App.class);
    	app.start(args);
    }
    
    @Autowired
    private Customer customer;
    
    private void start(String args[]) {
    	customer.getPerson().setName("hieuhay");
    	customer.getPerson().setAge(25);
    	customer.getPerson().setAddress("somewhere");
    	customer.setAction("singing");
    	customer.setType(1);
    	System.out.println(customer);
    }
}